import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { builtinModules } from 'module'


// https://vitejs.dev/config/
export default defineConfig({
    root: __dirname,
    base: './',
    plugins: [
        vue(),
    ],
    resolve: {
        alias: {
            '@': path.resolve(__dirname, 'src')
        },
    },
    server: {
        port: 4321,
        host: '0.0.0.0'
    },
    optimizeDeps: {
        exclude: ['electron'], // 告诉 Vite 排除预构建 electron，不然会出现 __diranme is not defined
    },
    build:{
        rollupOptions: [
            'electron',
            ...builtinModules
        ]
    }
})
